Skip to content

Conversation

nikoulis
Copy link

Modified create_full_tear_sheet() and create_simple_tear_sheet() to optionally return matplotlib figures based on the return_fig boolean parameter, in analogy to other tear sheet functions, such as create_returns_tear_sheet(), create_position_tear_sheet() etc. Now these two tear sheet functions can be used outside of IPython (%matplotlib inline) environments to capture these tear sheets and display them, convert them to pdf files etc.

If return_fig==True, create_full_tear_sheet() now returns the following dictionary containing all the matplotlib figures that were created internally:

{
'returns': fig_returns,
'interesting_times': fig_interesting_times,
'position': fig_position,
'txn': fig_txn,
'round_trip': fig_round_trip,
'capacity': fig_capacity,
'perf_attrib': fig_perf_attrib
}

And if return_fig==True, create_simple_tear_sheet() returns the matplotlib figure already created internally.

@reisenmachtfreude
Copy link

reisenmachtfreude commented Sep 17, 2023

Thanks for your pr. I need this functionality as well.

Since I just want to programmatically store pyfolio results for later analysis I can go this way
jupyter nbconvert --to pdf backtrader_backtest_pyfolio.ipynb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants